package socket

import "gluenet/pkg/apis"

func InfosList(c *apis.StorageContext) {
	var metrics []string
	c.InfoFlusher.Info.Range(func(key, value interface{}) bool {
		metrics = append(metrics, key.(string))
		return true
	})
	c.WebContext.JSON(apis.ResponseOK(metrics))
}

func InfosGet(c *apis.StorageContext) {
	key := c.WebContext.URLParam("key")
	data, _ := c.InfoFlusher.Info.Load(key)
	c.WebContext.JSON(apis.ResponseOK(data))
}
